﻿<?xml version="1.0"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Blazing.BusinessObjects" namespace="Blazing.BusinessObjects.Cms" >
	<class name="Contentpage" table="pages" dynamic-insert="true" dynamic-update="true">

		<id name="ID" column="pageid" type="Int32">
			<generator class="native" />
		</id>
		<timestamp column="rowstamp" name="RowStamp" />

		<property name="Name" length="100" not-null="true" />
		<property name="PageTitle" length="255" />
		<property name="Content" type="StringClob" length="4000" />
    <property name="CreatedBy" length="50" />
    <property name="ModifiedBy" length="50" />

		<many-to-one name="PageType" column="pagetypeid" class="PageType" not-null="true" />
		<many-to-one name="ParentPage" column="parentid" class="Contentpage" />
		<many-to-one name="Site" column="siteid" class="Site" not-null="true" />
		<many-to-one name="Masterpage" column="masterpageid" class="Masterpage" not-null="true" />
		<many-to-one name="Theme" column="themeid" class="Theme" not-null="true" />

		<property name="Url" length="300" not-null="true" />
		<property name="IsHttps" column="https" type="Boolean" />
		<property name="IsActive" column="active" type="Boolean" not-null="true" />
		<property name="Comments" length="300" />
		<property name="MetaKeywords" length="500" />
		<property name="MetaDescription" length="500" />
    <property name="MetaExtra" length="1000" />
		<property name="PermaLink" length="300" />
    <property name="CreatedDate" type="DateTime" not-null="true" />

    <set name="MenuItems" table="pagemenuitems">
      <key column="pageid" foreign-key="pageid" />
      <many-to-many class="MenuItem" column="menuitemid" />
    </set>

    <set name="TaxonomyTags" table="pagetaxonomytags">
      <key column="pageid"/>
      <many-to-many class="Blazing.BusinessObjects.Tagging.TaxonomyTag" column="taxonomytagid"/>       
    </set>

    <list name="Widgets" table="pagewidgets">
      <key column="pageid" />
      <index column="widgetorder" type="Int32" />
      <composite-element class="Blazing.BusinessObjects.Widgets.PageWidget">
        <parent name="Page" />
        <property name="Parameters" length="500" />
        <many-to-one name="Region" class="Blazing.BusinessObjects.Widgets.WidgetRegion" column="widgetregionid" not-null="true" />
        <many-to-one name="Widget" class="Blazing.BusinessObjects.Widgets.Widget" column="widgetid" not-null="true" />
      </composite-element>
    </list>

    <set name="FeedbackItems" table="pagefeedbackitems" cascade="save-update">
      <key column="pageid"/>
      <many-to-many class="FeedbackItem" column="feedbackitemid"/>
    </set>

  </class>
</hibernate-mapping>
